package junior.db.dao.ext;

import com.google.common.collect.ImmutableMap;
import junior.util.BeanUtils;

import java.util.Map;

public interface IEntityExt {
    
    void setExt(Map<String, Object> ext);
    
    Map<String, Object> getExt();
    
    static Class<?> extend(Class<?> targetClass) throws Exception {
        return BeanUtils.implInterfaces(targetClass.getName() + "$ImportExt", targetClass, new Class[] {IEntityExt.class},
                ImmutableMap.of("ext", Map.class),
                new String[] {
                        "public void setExt(java.util.Map ext) {this.ext = ext;}",
                        "public java.util.Map getExt() {return ext;}"
                }, false);
    }
}
